angular.module('MymusicList.controllers', []) //歌手歌单指令
	.controller('MymusicListCtrl', function($scope, Chats,$http) {
		var userData = {
			myMusicList: [{
				name: "我的最爱",
				data: [
					44805341, 7313038, 7280177
				]
			}, {
				name: "my Love",
				data: [
					7280177, 7313038,
				]
			}],
			playSong: [
				7313038
			],
			playSongList: [
				"public_tuijian_autumn"
			],
			myLike: [
				44805341
			]
		}
		userData = JSON.stringify(userData)
		localStorage.setItem("userData", userData)
		var data = localStorage.getItem("userData")
		data = JSON.parse(data)
		var myMusic = data.myMusicList
		var myMusicList = []
		var music_name = []
		var music_num = []
		myMusic.map(function(ev) {
			var music_list = ev.data
				music_name.push(ev.name)
				music_num.push(ev.data.length)
				song = "method=baidu.ting.song.play&songid=" + music_list[0]
				Chats.music(song).then(function(data) {
					myMusicList.push(data.data.songinfo)
				})
		})
//		console.log(music_num)
		$scope.music_num = music_num
		$scope.myMusicName = music_name
		$scope.myMusicList = myMusicList
		$scope.w_onOff = false;
		var w_num = 0;
		var w_num2 = 0;
		var w_num3 = 0;
		$scope.w_lanch = function(){
			w_num++
			if(w_num % 2 >0){
			$('.w_headerright span').removeClass();
			$('.w_headerright span').addClass('ion-ios-arrow-down');
			$scope.w_onOff = true;
			}else{
				$scope.w_onOff = false;
				$('.w_headerright span').addClass('ion-ios-arrow-right');
			}
		}
		$scope.w_lanch2 = function(){
			w_num2++
			if(w_num2 % 2 >0){
			$('.w_headerright2 span').removeClass();
			$('.w_headerright2 span').addClass('ion-ios-arrow-down');
			}else{
				$('.w_headerright2 span').addClass('ion-ios-arrow-right');
			}
		}
		$scope.w_lanch3 = function(){
			w_num3++
			if(w_num3 % 2 >0){
			$('.w_headerright3 span').removeClass();
			$('.w_headerright3 span').addClass('ion-ios-arrow-down');
			
			}else{
				
				$('.w_headerright3 span').addClass('ion-ios-arrow-right');
			}
		}
		
		var w_getVideoImg = localStorage.getItem('w_videoList');
        var w_getVideoName = localStorage.getItem('w_videoNameList');
		w_getVideoImg = JSON.parse(w_getVideoImg);
//		console.log( w_getVideoImg)
		$scope.getVideoImg2 = w_getVideoImg;
//		console.log($scope.getVideoImg2)
		w_getVideoName = JSON.parse(w_getVideoName);
//      console.log(w_getVideoName)
		$scope.getVideoName = w_getVideoName;
//		console.log($scope.getVideoName)

	})